package com.example.feifei.fragment.buy.ui;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;


import com.example.feifei.fragment.buy.adapter.OrderShopAdapter;
import com.example.feifei.fragment.buy.bean.OrderShopBean;
import com.example.feifei.newproject.R;
import com.jude.easyrecyclerview.EasyRecyclerView;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;


/**
 * 填写订单Fragment
 * Created by feifei on 2017/12/22.
 */

public class ShopOrderFragment extends Fragment {
    private View root_view;
    private Context mContext;

    //订单商品列表
    @BindView(R.id.recycle_orderList)
    EasyRecyclerView recycle_orderList;

    //商品列表适配器
    OrderShopAdapter orderAdapter;

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        mContext = context;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
        root_view = inflater.inflate(R.layout.fragment_shoporder,null);
        ButterKnife.bind(this,root_view);
        root_view.setClickable(true);
        initView();
        return root_view;
    }



    private void initView() {
        recycle_orderList.setLayoutManager(new LinearLayoutManager(mContext));
        orderAdapter = new OrderShopAdapter(mContext);
        recycle_orderList.setAdapter(orderAdapter);
        orderAdapter.addAll(getOrderList());

    }

    private List<OrderShopBean> getOrderList(){
        List<OrderShopBean> orderList = new ArrayList<>();
        for(int i = 0;i<5;i++){
            OrderShopBean bean = new OrderShopBean();
            orderList.add(bean);
        }
        return  orderList;
    }
}
